#include "stdio.h"
//Common header files
#include "hardware.h"

//Core header files
#include "Dual_Link_List.h"

//Testing header files
#include "CreateLinkListHelper.h"
#include "PrintDataHelper.h"

//Main testing entry
int main() {
	//p_ListNode list = create_link_list("ListConfiguration.txt");
	p_ListNode list = create_link_list_with_INT8_Node("TestProject/Test_data/int_case.txt");
	if(!list) {
		printf("fail to create Link List!\n");
		exit(1);
	}
	print_list(list,print_INT8);
	printf("The length of the link list is %d\n",get_length(list));

	if(insert_node(list,0,(void*)2) == FAILURE) {
		printf("fail to insert new node\n");
		printf("Program exit!\n");
		exit(1);
	}
	print_list(list,print_INT8);
	printf("The length of the link list is %d\n",get_length(list));	
	
	//char* data = (char*)malloc(sizeof(char));
	INT8* data = (INT8*)malloc(sizeof(INT8));
	if(delete_node(list,0,(void*)data) == FAILURE) {
		printf("Fail to delete the node\n");	
		printf("Program exit!\n");
		exit(1);
	}
	printf("Node %d has been deleted from the list\n",*data);
	print_list(list,print_INT8);
	printf("The length of the link list is %d\n",get_length(list));	

	destroy_link_list(list);

	return 0;
}
